<!-- table data -->
<table id="data" cellpadding="4" cellspacing="0">
    <tr class="row-search">
        <td colspan="<?php echo count($columns);?>">
            <!-- <a href="javascript:void(0);">CREATE</a> -->

            <!-- search through table -->
            <span class="search">
                <form method="post" action="" id="search">
                    <input type="hidden" name="type"    value="search" />
                    <input type="text"   name="keyword" maxlength="100" required />
                    <input type="submit" value="SEARCH" />
                </form>
            </span>
        </td>
    </tr>

    <tr class="row-headers">
        <!-- field names -->
        <?php foreach ($columns as $column) :?>
            <th><?php echo strtoupper(str_replace('_', ' ', $column));?></th>
        <?php endforeach;?>
    </tr>

    <!-- data -->
    <?php $light = TRUE;?>
    <?php foreach ($rows as $key => $row) :?>
        <tr onclick="showDetails(<?php echo $_POST['offset'] . ', ' . $key?>);" class="row-data <?php echo $light ? 'light' : 'dark';?>">
            <?php foreach ($columns as $column) :?>
            <td><?php echo $row[$column];?></td>
            <?php endforeach?>
        </tr>
        <?php $light = $light ? FALSE : TRUE;?>
    <?php endforeach;?>
</table>

<div id="pagination">
    <?php for ($i = 1; $i <= $pages; $i++) :?>
    <a href="javascript:void(0);" onclick="loadPage('<?php echo $_POST['table']?>', <?php echo $i?>);"><?php echo $i?></a>
    <?php endfor;?>
</div>